import java.util.ArrayList;
import java.util.List;

class User{
    public int id;
    public String name;

    @Override
    public String toString() {
        return id +" " + name;
    }
}
public class Test07 {
    public static void main(String[] args) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("123");
        func2(stringBuilder);
        System.out.println(stringBuilder);

    }
    public static void func2(StringBuilder s){
        s.delete(0,s.length());
        s.append("456");

    }
    public static void main3(String[] args) {
        //String的不可变性
        String str = "123";
        func(str);
        System.out.println(str);
    }
    public static void func(String s){
        s = "456";
    }
    public static void main2(String[] args) {
        List<User> list = new ArrayList<>();
        User user = new User();
        user.id = 1;
        user.name = "zs";
        User user2 = new User();
        user2.id = 2;
        user2.name = "lisi";
        list.add(user);
        list.add(user2);

        list.remove(list.get(list.size()-1));
        System.out.println(list);
    }
    public static void main1(String[] args) {
        char[] arr = new char[]{'a','b','c'};
        System.out.println(arr);
    }
}
